import cache from '../cache'

export default {
  created() {
    const to = this.$route
    const key = `${to.name || to.path}?${to.query.VNK}`
    const data = cache[key]
    const status = data ? true : false

    if(status){
      Object.assign(this, data, {status})

      if(this.$forceCache)
        delete this.$forceCache
    }
    to.matched[0].components.default.cache && to.matched[0].components.default.cache.call(this)
  }
}
